package com.example.abstractfactory.factory;

import com.example.abstractfactory.color.Color;
import com.example.abstractfactory.color.impl.Blue;
import com.example.abstractfactory.color.impl.Green;
import com.example.abstractfactory.color.impl.Red;
import com.example.abstractfactory.factory.AbstractFactory;
import com.example.abstractfactory.shape.Shape;
import org.springframework.util.StringUtils;

/**
 * @Description TODO
 * @Date 2021/10/21 10:58
 * @Author ZhangJi
 * @Version 1.0
 */
public class ColorFactory extends AbstractFactory {

  @Override
  public Shape getShape(String shape) {
    return null;
  }

  @Override
  public Color getColor(String color) {

    if (!StringUtils.hasLength(color)) {
      return null;
    }
    switch (color){
      case "Red":
        return new Red();
      case "Blue":
        return new Blue();
      case "Green":
        return new Green();
      default:
        return null;
    }

  }
}
